#ifndef GSETTINGMANAGER_H
#define GSETTINGMANAGER_H

#include <QObject>
#include <QGSettings>
#include <QGuiApplication>
#include <QDebug>

//! 控制中心-个性化部分
#define CONTROL_CENTER_PERSONALISE_SETTING          "org.ukui.control-center.personalise"
#define CONTROL_CENTER_PERSONALISE_TRANS_KEY        "transparency"
#define CONTROL_CENTER_PERSONALISE_ISCHECKED_KEY    "ischecked"

class ControlCenterPersonGsetting : public QObject
{
    Q_OBJECT
public:
    ControlCenterPersonGsetting();
    ~ControlCenterPersonGsetting();

    static ControlCenterPersonGsetting *getInstance();

    double getTransparency();
    void setIschecked(bool state);

private:
    QGSettings *m_pControlCenterSetting = nullptr;

Q_SIGNALS:
    void Sig_personChanged(QString arg);

};

//! 控制中心-消息通知部分
#define CONTROL_CENTER_NOTIFICATION_SETTING        "org.ukui.control-center.noticeorigin"
#define CONTROL_CENTER_NOTIFICATION_PATH           "/org/ukui/control-center/noticeorigin/"
#define CONTROL_CENTER_NOTIFICATION_MESSAGE_KEY    "messages"
#define CONTROL_CENTER_NOTIFICATION_MAXIMINE_KEY   "maximize"
#define CONTROL_CENTER_NOTIFICATION_NAME_KEY       "nameCn"

class ControlCenterNotiGsetting : public QObject
{
    Q_OBJECT
public:
    ControlCenterNotiGsetting();
    ~ControlCenterNotiGsetting();

    static ControlCenterNotiGsetting *getInstance();

    QString getNotificationName();
    int getMixNum();
    bool getMessage();

private:
    QGSettings *m_pControlCenterSetting = nullptr;
    QList<char*> listExistsPath();

Q_SIGNALS:
    void Sig_appNotifySettingChanged();

};

//! 控制中心-面板部分
#define CONTROL_CENTER_PANEL_SETTING        "org.ukui.control-center.panel.plugins"
#define CONTROL_CENTER_PANEL_HOUR_KEY       "hoursystem"
#define CONTROL_CENTER_PANEL_DATE_KEY       "date"

#define TIME_FORMAT "12"
#define DATE_FORMAT "cn"

class ControlCenterPanelGsetting : public QObject
{
    Q_OBJECT
public:
    ControlCenterPanelGsetting();
    ~ControlCenterPanelGsetting();

    static ControlCenterPanelGsetting *getInstance();
    QString getHourSystem();
    QString getDateSystem();

private:
    QGSettings *m_pControlCenterSetting = nullptr;

Q_SIGNALS:
    void Sig_appNotifySettingChanged(QString arg);

};


//! 消息通知
#define UKUI_NOTIFICATION_SETTING         "org.notification.settings"
#define UKUI_NOTIFICATION_KEY             "showflag"
#define UKUI_NOTIFICATION_STATE_KEY       "state"

class NotificationGsetting : public QObject
{
public:
    NotificationGsetting();
    ~NotificationGsetting();

    static NotificationGsetting *getInstance();
    void setShowFlag(bool showFlag);
    void setState(bool state);

private:
    QGSettings *m_pNotificationSetting = nullptr;

};


//! 任务栏
#define UKUI_PANEL_SETTING          "org.ukui.panel.settings"
#define UKUI_PANEL_SIZE_KEY         "panelsize"
#define UKUI_PANEL_POSITION_KEY     "panelposition"

class PanelGsetting : public QObject
{
    Q_OBJECT
public:
    PanelGsetting();
    ~PanelGsetting();

    static PanelGsetting *getInstance();
    int getPanelSize();
    int getPanelPosition();

private:
    QGSettings *m_pPanelSetting = nullptr;

Q_SIGNALS:
    void Sig_panelGsettingChanged(QString key);

};

//! 锁屏
#define UKUI_SCREENSAVER_SETTING        "org.ukui.screensaver"
#define UKUI_SCREENSAVER_MESSAGE_KEY    "messageNumber"

class ScreensaverGsetting : public QObject
{

public:
    ScreensaverGsetting();
    ~ScreensaverGsetting();

    static ScreensaverGsetting *getInstance();
    void setMessageNum(int num);

private:
    QGSettings *m_pScreensaverSetting = nullptr;

};

//! ukui-style
#define UKUI_STYLE_SETTING          "org.ukui.style"
#define UKUI_STYLE_FONT_KEY         "systemFont"
#define UKUI_STYLE_FONT_SIZE_KEY    "systemFontSize"
#define UKUI_STYLE_NAME_KEY         "styleName"
#define UKUI_STYLE_THEME_COLOR      "themeColor"

#define DEFAULT_STYLE            "ukui-default"
#define BLACK_STYLE              "ukui-black"
#define WHITE_STYLE              "ukui-white"
#define DARK_STYLE               "ukui-dark"
#define LIGHT_STYLE              "ukui-light"

class StyleGsetting : public QObject
{
    Q_OBJECT
public:
    StyleGsetting();
    ~StyleGsetting();

    static StyleGsetting *getInstance();

    QString getStyleName();
    void setStyleName(QString styleName);
    double getFontSize();

private:
    QGSettings *m_pStyleSetting = nullptr;

Q_SIGNALS:
    void Sig_styleGsettingChanged(QString key);

};


//! 侧边栏快捷操作面板部分gsetting
#define QUICK_OPERATION_SETTING                       "org.ukui.quick-operation.panel"
#define QUICK_OPERATION_GSETTING_VALUE_STATUS         "disturbmodestatus"
#define QUICK_OPERATION_GSETTING_VALUE_SOUNDOFF       "disturbmodesoundoff"
#define QUICK_OPERATION_GSETTING_VALUE_NOTIFYCLOSE    "disturbmodenotifyclose"
#define QUICK_OPERATION_GSETTING_VALUE_UKUI_VOLUME_KEY "volumesize"
#define QUICK_OPERATION_GSETTING_VALUE_UKUI_MUTE_KEY   "soundstate"
class QuickOperationGsetting : public QObject
{
    Q_OBJECT
public:
    QuickOperationGsetting();
    ~QuickOperationGsetting();

    static QuickOperationGsetting *getInstance();

    bool getModeStatus();
    void setModeStatus(bool state);
    void setModeSoundState(bool state);
    void setModeNotifyState(bool state);

    int getVolume();
    void setVolume(int num);

    bool getSoundState();

private:
    QGSettings *m_pQuickOperationSetting = nullptr;

Q_SIGNALS:
    void Sig_quickOperationChanged(QString key);

};

//! 电源管理-
#define POWER_MODE_SETTING             "org.ukui.power-manager"
#define POWER_MODE_BRIGHT_AC_KEY       "brightnessAc"

#define POWER_MODE_POWERPOLICYBATTERY  "powerPolicyBattery"
#define POWER_MODE_POWERPOLICYAC       "powerPolicyAc"

// 节电接口参数说明：0：性能模式；1：平衡模式；2：节能模式

class PowerModeGsetting : public QObject
{
    Q_OBJECT
public:
    PowerModeGsetting();
    ~PowerModeGsetting();

    static PowerModeGsetting *getInstance();

    int  getBrightnessAc();
    void setBrightnessAc(int num);

    int  getPowerPolicyBattery();
    void setPowerPolicyBattery(int num);

    int  getPowerPolicyAc();
    void setPowerPolicyAc(int num);

private:
    QGSettings *m_pPowerModeSetting = nullptr;

Q_SIGNALS:
    void Sig_powerModeChanged(QString key);

};

//! 蓝牙
#define BLUE_TOOTH_SETTING        "org.ukui.bluetooth"
#define BLUE_TOOTH_SWITCH_KEY     "switch"

class BluetoothGsetting : public QObject
{
    Q_OBJECT
public:
    BluetoothGsetting();
    ~BluetoothGsetting();

    static BluetoothGsetting *getInstance();

    bool getSwitch();
    void setSwitch(bool state);

private:
    QGSettings *m_pBluetoothSetting = nullptr;

Q_SIGNALS:
    void Sig_bluetoothChanged(QString key);

};

//! mate 主题
#define GTK_STYLE_SETTING        "org.mate.interface"
#define GTK_STYLE_KEY            "gtkTheme"

class GtkStyleGsetting : public QObject
{
    Q_OBJECT
public:
    GtkStyleGsetting();
    ~GtkStyleGsetting();

    static GtkStyleGsetting *getInstance();

    void setGtkTheme(QString styleName);

private:
    QGSettings *m_pGtkStyleSetting = nullptr;

};

//! 麒麟天气
#define WEATHER_GSETTING_NEW     "org.kylin-weather.settings"
#define WEATHER_GSETTING_KEY     "weather"

class WeatherGsetting : public QObject
{
    Q_OBJECT
public:
    WeatherGsetting();
    ~WeatherGsetting();

    static WeatherGsetting *getInstance();

    QString getWeather();
    QString getIcon();

private:
    QGSettings *m_pWeatherSetting = nullptr;

Q_SIGNALS:
    void Sig_weatherChanged(QString key);

};

//! 护眼中心
#define EYEPROTECTION_GSETTING             "org.ukui.eyeprotection-backend.tablemodemonitor"
#define EYEPROTECTION_TIME_KEY             "timeReminder"
#define EYEPROTECTION_DISTANCE_KEY         "distanceReminder"

class EyeprotectionGsetting : public QObject
{
    Q_OBJECT
public:
    EyeprotectionGsetting();
    ~EyeprotectionGsetting();

    static EyeprotectionGsetting *getInstance();

    bool getTimeReminder();
    bool getDistanceReminder();

    void setTimeReminder(bool state);
    void setDistanceReminder(bool state);

private:
    QGSettings *m_pEyeprotectionSetting = nullptr;

Q_SIGNALS:
    void Sig_eyeprotectionChanged(QString key);

};

//! settingDaemon
#define SETTINGSDAEMON_GSETTING        "org.ukui.SettingsDaemon.plugins.color"
#define SETTINGSDAEMON_KEY             "nightLightEnabled"
#define SETTINGSDAEMON_THEME_KEY       "themeScheduleAutomatic"
#define SETTINGSDAEMON_DARK_MODE_KEY   "darkMode"

class SettingsDaemonGsetting : public QObject
{
    Q_OBJECT
public:
    SettingsDaemonGsetting();
    ~SettingsDaemonGsetting();

    static SettingsDaemonGsetting *getInstance();

    bool getnightLightEnabled();
    void setnightLightEnabled(bool state);

    bool getThemeScheduleAutomatic();
    void setThemeScheduleAutomatic(bool state);

private:
    QGSettings *m_pSettingsDaemonSetting = nullptr;

Q_SIGNALS:
    void Sig_settingsDaemonChanged(QString key);

};

// 1：飞行模式开启，0：飞行模式关闭，-1 ：不支持飞行模式
//! settingDaemon.media-keys
#define SETTINGSDAEMON_MEDIA_GSETTING        "org.ukui.SettingsDaemon.plugins.media-keys-state"
#define SETTINGSDAEMON_MEDIA_KEY             "rfkillState"
#define SETTINGSDAEMON_MEDIA_VOLUME_KEY      "sinkVolume"
#define SETTINGSDAEMON_MEDIA_SINK_MUTE_KEY   "sinkMute"

class SettingsDaemonMediaGsetting : public QObject
{
    Q_OBJECT
public:
    SettingsDaemonMediaGsetting();
    ~SettingsDaemonMediaGsetting();

    static SettingsDaemonMediaGsetting *getInstance();

    int getRfkillState();
    void setRfkillState(int num);

    int getSinkVolume();
    void setSinkVolume(int num);

    bool getSoundState();
    void setSoundState(bool state);

private:
    QGSettings *m_pSettingsDaemonMediaSetting = nullptr;

Q_SIGNALS:
    void Sig_mediaGsettingChanged(QString key);

};

#endif // GSETTINGMANAGER_H
